package cn.good.yan.service.t11;

import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReentrantLock;

/**
 * 11.AQS
 *
 * @author shengren.yan
 * @create 2024-04-10
 */
public class Aqs1 {
    public static void main(String[] args) {
        // 非公平锁
        Lock lock = new ReentrantLock();
        // 公平锁
        // Lock lock = new ReentrantLock(true);
        lock.lock();
        try {
            System.out.println("加锁 -- 执行逻辑");
        } finally {
            lock.unlock();
        }
    }
}
